inspector: Show readonly property values
authorMatthias Clasen <mclasen@redhat.com>
Fri, 12 Apr 2019 19:07:01 +0000 (15:07 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 12 Apr 2019 19:08:01 +0000 (15:08 -0400)
gtk/inspector/prop-editor.c
gtk/inspector/prop-list.c
gtk/inspector/prop-list.h

index 75ccede57c0509dd8afbc7f4c5dd42c9192e502b..1c1b5541acc308b7df0a8cd2c379603cdee578f5 100644 (file)
@@ -21,6 +21,7 @@
 #include "prop-editor.h"
 #include "strv-editor.h"
 #include "object-tree.h"
+#include "prop-list.h"
 
 #include "gtkactionable.h"
 #include "gtkadjustment.h"
@@ -1555,7 +1556,27 @@ constructed (GObject *object)
     can_modify = TRUE;
 
   if (!can_modify)
-    return;
+    {
+      GValue gvalue = {0};
+      gchar *value;
+      gchar *type;
+
+      g_value_init (&gvalue, spec->value_type);
+      g_object_get_property (editor->priv->object, spec->name, &gvalue);
+      strdup_value_contents (&gvalue, &value, &type);
+
+      label = gtk_label_new (value);
+      gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_DIM_LABEL);
+      gtk_container_add (GTK_CONTAINER (box), label);
+
+      g_free (value);
+      g_free (type);
+
+      if (editor->priv->size_group)
+        gtk_size_group_add_widget (editor->priv->size_group, box);
+      gtk_container_add (GTK_CONTAINER (editor), box);
+      return;
+    }
 
   editor->priv->editor = property_editor (editor->priv->object, spec, editor);
   gtk_container_add (GTK_CONTAINER (box), editor->priv->editor);
index 9e6391dca6bd9bd41730760cbe67741099f2f6ce..f1cbeb23b8ce6455bf8d25bd62662b37f0d37ed4 100644 (file)
@@ -252,7 +252,7 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
 }
 
 /* Like g_strdup_value_contents, but keeps the type name separate */
-static void
+void
 strdup_value_contents (const GValue  *value,
                        gchar        **contents,
                        gchar        **type)
index ad7219f13b68e76b65f3bbb6a2c29cac42c25be1..ef7896e550c930f4a09e9b2dc384b537dcfb9f8e 100644 (file)
@@ -56,6 +56,11 @@ gboolean   gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
 void gtk_inspector_prop_list_set_layout_child (GtkInspectorPropList *pl,
                                                GObject              *object);
 
+void strdup_value_contents (const GValue  *value,
+                            gchar        **contents,
+                            gchar        **type);
+
+
 
 G_END_DECLS